package com.neutech.springframework.controller;

import com.neutech.springframework.entity.User;
import com.neutech.springframework.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

@Controller
public class UserController {
    private IUserService service;
    @Autowired
    public void setService(IUserService service) {
        this.service = service;
    }

    @RequestMapping(value = {"/user"},method = RequestMethod.GET)
    public String findAll(ModelMap map){
        List<User> users = service.selectAll();
        map.addAttribute("user", users);
        return "user_list.jsp";
    }
}




























